﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DbSharp.Framework.ReleaseManage;

namespace DbSharp.Framework.TestEngine
{
    public class CaseFileLoadedReport
    {
        public int TotalPerfCaseCount { get; set; }
        public int TotalUnitCaseCount { get; set; }
        public int LoadedPerfCaseCount { get; set; }
        public int LoadedUnitCaseCount { get; set; }
        public string CaseFileError { get; set; }

        public override string ToString()
        {
            string msgFmt;
            if (string.IsNullOrEmpty(CaseFileError))
            {
                StringBuilder sb = new StringBuilder();
                msgFmt = SensitiveMessage.CaseXmlLoadMsgFmt;
                sb.AppendLine(string.Format(msgFmt, LoadedPerfCaseCount, TotalPerfCaseCount, LoadedUnitCaseCount, TotalUnitCaseCount));

                if (LoadedPerfCaseCount < TotalPerfCaseCount)
                {
                    msgFmt = SensitiveMessage.PerfCaseCountOverflowMsgFmt;
                    sb.AppendLine(string.Format(msgFmt, LoadedPerfCaseCount));
                }

                if (LoadedUnitCaseCount < TotalUnitCaseCount)
                {
                    msgFmt = SensitiveMessage.UnitCaseCountOverflowMsgFmt;
                    sb.AppendLine(string.Format(msgFmt, LoadedUnitCaseCount));
                }
                return sb.ToString();
            }
            else
            {
                msgFmt = SensitiveMessage.CaseXmlFileErrorMsgFmt;
                return string.Format(msgFmt, CaseFileError);
            }
        }
    }


}
